package com.qf.spring.service.advices;

import org.springframework.aop.AfterReturningAdvice;
import org.springframework.aop.MethodBeforeAdvice;

import java.lang.reflect.Method;

/**
 * @author 王博康
 * @version 1.0
 * @project 03_spring
 * @description: TODO
 * @date 2022/3/6 0:18 星期日
 */
public class MyAdvice implements MethodBeforeAdvice ,AfterReturningAdvice {
    @Override
    public void before(Method method, Object[] args, Object target) throws Throwable {
        System.err.println("开启事务");
    }

    @Override
    public void afterReturning(Object o, Method method, Object[] objects, Object o1) throws Throwable {
        System.err.println("提交事务");
    }
}
